inherited fmAddFoodPortion: TfmAddFoodPortion
  Left = 1018
  Top = 441
  Width = 495
  Height = 428
  Caption = #1056#1072#1089#1095#1077#1090' '#1082#1086#1083#1080#1095#1077#1089#1090#1074#1072' '#1087#1086#1088#1094#1080#1081
  Constraints.MinHeight = 428
  Constraints.MinWidth = 495
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 363
    Width = 479
  end
  inherited Panel1: TPanel
    Width = 479
    inherited BitBtn1: TBitBtn
      Left = 317
    end
    inherited BitBtn2: TBitBtn
      Left = 405
    end
  end
  object Panel2: TPanel [2]
    Left = 0
    Top = 45
    Width = 479
    Height = 269
    Align = alClient
    Caption = 'Panel2'
    TabOrder = 2
    object dbgFoodFactor: TcxGrid
      Left = 1
      Top = 1
      Width = 477
      Height = 267
      Align = alClient
      BevelEdges = [beTop, beRight, beBottom]
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 0
      LookAndFeel.Kind = lfStandard
      object tvFoodFactor: TcxGridDBTableView
        NavigatorButtons.ConfirmDelete = False
        NavigatorButtons.First.Visible = True
        NavigatorButtons.PriorPage.Visible = True
        NavigatorButtons.Prior.Visible = True
        NavigatorButtons.Next.Visible = True
        NavigatorButtons.NextPage.Visible = True
        NavigatorButtons.Last.Visible = True
        NavigatorButtons.Insert.Visible = False
        NavigatorButtons.Append.Visible = False
        NavigatorButtons.Delete.Visible = False
        NavigatorButtons.Edit.Visible = False
        NavigatorButtons.Post.Visible = False
        NavigatorButtons.Cancel.Visible = False
        NavigatorButtons.Refresh.Visible = False
        NavigatorButtons.SaveBookmark.Visible = False
        NavigatorButtons.GotoBookmark.Visible = False
        NavigatorButtons.Filter.Visible = False
        FilterBox.Position = fpTop
        DataController.DataSource = dsPortion
        DataController.Summary.DefaultGroupSummaryItems = <>
        DataController.Summary.FooterSummaryItems = <>
        DataController.Summary.SummaryGroups = <>
        FilterRow.InfoText = #1065#1077#1083#1082#1085#1080#1090#1077' '#1079#1076#1077#1089#1100' '#1076#1083#1103' '#1089#1086#1079#1076#1072#1085#1080#1103' '#1092#1080#1083#1100#1090#1088#1072
        NewItemRow.InfoText = #1065#1105#1083#1082#1085#1080#1090#1077' '#1079#1076#1077#1089#1100' '#1076#1083#1103' '#1076#1086#1073#1072#1074#1083#1077#1085#1080#1103' '#1085#1086#1074#1086#1081' '#1089#1090#1088#1086#1082#1080
        OptionsBehavior.CellHints = True
        OptionsBehavior.IncSearch = True
        OptionsCustomize.ColumnFiltering = False
        OptionsData.CancelOnExit = False
        OptionsData.Deleting = False
        OptionsData.DeletingConfirmation = False
        OptionsData.Editing = False
        OptionsData.Inserting = False
        OptionsView.NavigatorOffset = 10
        OptionsView.NoDataToDisplayInfoText = '<'#1053#1077#1090' '#1076#1072#1085#1085#1099#1093'>'
        OptionsView.CellAutoHeight = True
        OptionsView.CellTextMaxLineCount = 1
        OptionsView.ColumnAutoWidth = True
        OptionsView.Footer = True
        OptionsView.GroupByBox = False
        OptionsView.Indicator = True
        Preview.Visible = True
        Styles.IncSearch = DMInv.cxKrasniyText
        Styles.Selection = DMInv.cxJoltiyFon
        Styles.Header = DMInv.cxSiniyText
        object tvFoodFactorPDATE: TcxGridDBColumn
          Caption = #1044#1072#1090#1072
          DataBinding.FieldName = 'PDATE'
        end
        object tvFoodFactorET: TcxGridDBColumn
          Caption = #1057#1088#1077#1076#1085#1077#1077
          DataBinding.FieldName = 'ES'
        end
        object tvFoodFactorEK: TcxGridDBColumn
          Caption = #1050#1086#1101#1092#1092#1080#1094#1080#1077#1085#1090
          DataBinding.FieldName = 'EK'
        end
        object tvFoodFactorER: TcxGridDBColumn
          Caption = #1056#1077#1079#1077#1088#1074
          DataBinding.FieldName = 'ER'
        end
        object tvFoodFactorES: TcxGridDBColumn
          Caption = #1042#1089#1077#1075#1086
          DataBinding.FieldName = 'ET'
        end
        object tvFoodFactorEA: TcxGridDBColumn
          Caption = #1060#1072#1082#1090
          DataBinding.FieldName = 'EA'
        end
      end
      object cxGridLevel1: TcxGridLevel
        GridView = tvFoodFactor
      end
    end
  end
  object Panel3: TPanel [3]
    Left = 0
    Top = 314
    Width = 479
    Height = 49
    Align = alBottom
    TabOrder = 3
    object Label2: TLabel
      Left = 11
      Top = 4
      Width = 111
      Height = 13
      Caption = #1057#1088#1077#1076#1085#1077#1077' '#1079#1085#1072#1095#1077#1085#1080#1077':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Label1: TLabel
      Left = 251
      Top = 4
      Width = 44
      Height = 13
      Caption = #1056#1077#1079#1077#1088#1074':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Label3: TLabel
      Left = 131
      Top = 4
      Width = 82
      Height = 13
      Caption = #1050#1086#1101#1092#1092#1080#1094#1080#1077#1085#1090':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Label4: TLabel
      Left = 371
      Top = 3
      Width = 36
      Height = 13
      Caption = #1042#1089#1077#1075#1086':'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object eK: TcxCurrencyEdit
      Left = 128
      Top = 20
      Properties.DecimalPlaces = 2
      Properties.DisplayFormat = ',0.00'#39#39';-,0.00'#39#39
      Properties.EditFormat = '0'
      Properties.ReadOnly = True
      TabOrder = 0
      Width = 113
    end
    object eR: TcxCurrencyEdit
      Left = 248
      Top = 20
      Properties.DecimalPlaces = 0
      Properties.DisplayFormat = ',0'#39#39';-,0'#39#39
      Properties.EditFormat = '0'
      TabOrder = 1
      OnKeyUp = eRKeyUp
      Width = 113
    end
    object eT: TcxCurrencyEdit
      Left = 368
      Top = 20
      Properties.DecimalPlaces = 0
      Properties.DisplayFormat = ',0'#39#39';-,0'#39#39
      Properties.EditFormat = '0'
      TabOrder = 2
      OnKeyUp = eTKeyUp
      Width = 113
    end
    object eS: TcxCurrencyEdit
      Left = 8
      Top = 20
      Properties.DecimalPlaces = 0
      Properties.DisplayFormat = ',0'#39#39';-,0'#39#39
      Properties.EditFormat = '0'
      Properties.ReadOnly = True
      TabOrder = 3
      Width = 113
    end
  end
  object dsPortion: TDataSource
    DataSet = qPortion
    Left = 56
    Top = 64
  end
  object qPortion: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'select first :n fp.idportion, fp.pdate,fp.typeportion,'
      'case'
      '    when :coltype = 1 then fp.tnursery1'
      '    when :coltype = 2 then fp.tnursery2'
      '    when :coltype = 3 then fp.tnurserystaff'
      '    when :coltype = 4 then fp.tprimary'
      '    when :coltype = 5 then fp.tprimarystaff'
      '    when :coltype = 6 then fp.thigh'
      '    when :coltype = 7 then fp.thighstaff'
      '    when :coltype = 8 then fp.tstaff'
      'end as et,'
      'case'
      '    when :coltype = 1 then fp.rnursery1'
      '    when :coltype = 2 then fp.rnursery2'
      '    when :coltype = 3 then fp.rnurserystaff'
      '    when :coltype = 4 then fp.rprimary'
      '    when :coltype = 5 then fp.rprimarystaff'
      '    when :coltype = 6 then fp.rhigh'
      '    when :coltype = 7 then fp.rhighstaff'
      '    when :coltype = 8 then fp.rstaff'
      'end as er,'
      'case'
      '    when :coltype = 1 then fp.knursery1'
      '    when :coltype = 2 then fp.knursery2'
      '    when :coltype = 3 then fp.knurserystaff'
      '    when :coltype = 4 then fp.kprimary'
      '    when :coltype = 5 then fp.kprimarystaff'
      '    when :coltype = 6 then fp.khigh'
      '    when :coltype = 7 then fp.khighstaff'
      '    when :coltype = 8 then fp.kstaff'
      'end as ek,'
      'case'
      '    when :coltype = 1 then fp.anursery1'
      '    when :coltype = 2 then fp.anursery2'
      '    when :coltype = 3 then fp.anurserystaff'
      '    when :coltype = 4 then fp.aprimary'
      '    when :coltype = 5 then fp.aprimarystaff'
      '    when :coltype = 6 then fp.ahigh'
      '    when :coltype = 7 then fp.ahighstaff'
      '    when :coltype = 8 then fp.astaff'
      'end as ea,'
      'case'
      '    when :coltype = 1 then fp.snursery1'
      '    when :coltype = 2 then fp.snursery2'
      '    when :coltype = 3 then fp.snurserystaff'
      '    when :coltype = 4 then fp.sprimary'
      '    when :coltype = 5 then fp.sprimarystaff'
      '    when :coltype = 6 then fp.shigh'
      '    when :coltype = 7 then fp.shighstaff'
      '    when :coltype = 8 then fp.sstaff'
      'end as es'
      'from f_portion fp'
      
        'where fp.pdate < :pdate and fp.typeportion= :typeportion and ((f' +
        'p.isnotuse=0) or (fp.isnotuse is null))'
      'order by fp.pdate desc')
    GeneratorField.Field = 'SDID'
    Left = 88
    Top = 64
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'n'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pdate'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'typeportion'
        ParamType = ptUnknown
      end>
    object qPortionPDATE: TDateField
      FieldName = 'PDATE'
      Origin = '"F_PORTION"."PDATE"'
    end
    object qPortionTYPEPORTION: TIntegerField
      FieldName = 'TYPEPORTION'
      Origin = '"F_PORTION"."TYPEPORTION"'
    end
    object qPortionET: TIntegerField
      FieldName = 'ET'
      ProviderFlags = []
    end
    object qPortionER: TIntegerField
      FieldName = 'ER'
      ProviderFlags = []
    end
    object qPortionEK: TIBBCDField
      FieldName = 'EK'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object qPortionEA: TIntegerField
      FieldName = 'EA'
      ProviderFlags = []
    end
    object qPortionES: TIBBCDField
      FieldName = 'ES'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object qPortionIDPORTION: TIntegerField
      FieldName = 'IDPORTION'
      Origin = '"F_PORTION"."IDPORTION"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
  end
  object dsFactorp: TDataSource
    DataSet = qFactorp
    Left = 56
    Top = 96
  end
  object qFactorp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'Select fp.idfactorp,'
      'case'
      '    when :coltype = 1 then fp.fgroup1a'
      '    when :coltype = 2 then fp.fgroup2a'
      '    when :coltype = 3 then fp.fgroup5a1'
      '    when :coltype = 4 then fp.fgroup3a'
      '    when :coltype = 5 then fp.fgroup5a3'
      '    when :coltype = 6 then fp.fgroup4a'
      '    when :coltype = 7 then fp.fgroup5a4'
      '    when :coltype = 8 then fp.fgroup5a'
      'end as ta,'
      'case'
      '    when :coltype = 1 then fp.fgroup1b'
      '    when :coltype = 2 then fp.fgroup2b'
      '    when :coltype = 3 then fp.fgroup5b1'
      '    when :coltype = 4 then fp.fgroup3b'
      '    when :coltype = 5 then fp.fgroup5b3'
      '    when :coltype = 6 then fp.fgroup4b'
      '    when :coltype = 7 then fp.fgroup5b4'
      '    when :coltype = 8 then fp.fgroup5b'
      'end as tb,'
      'case'
      '    when :coltype = 1 then fp.fgroup1n'
      '    when :coltype = 2 then fp.fgroup2n'
      '    when :coltype = 3 then fp.fgroup5n1'
      '    when :coltype = 4 then fp.fgroup3n'
      '    when :coltype = 5 then fp.fgroup5n3'
      '    when :coltype = 6 then fp.fgroup4n'
      '    when :coltype = 7 then fp.fgroup5n4'
      '    when :coltype = 8 then fp.fgroup5n'
      'end as tn'
      'from f_factorp fp'
      'where fp.typefactorp = :typeportion')
    GeneratorField.Field = 'SDID'
    Left = 88
    Top = 96
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'typeportion'
        ParamType = ptUnknown
      end>
    object qFactorpIDFACTORP: TIntegerField
      FieldName = 'IDFACTORP'
      Origin = '"F_FACTORP"."IDFACTORP"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qFactorpTA: TIBBCDField
      FieldName = 'TA'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object qFactorpTB: TIBBCDField
      FieldName = 'TB'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object qFactorpTN: TIBBCDField
      FieldName = 'TN'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
  end
  object qAVG: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'select ds2.ss/ds2.nn as Sr'
      'from'
      '(select cast((sum(ds.es*ds.ek)) as float) as ss , ds.nn'
      'from ('
      'select first :n fp.idportion, fp.pdate,fp.typeportion,'
      'case'
      '    when :coltype = 1 then fp.tnursery1'
      '    when :coltype = 2 then fp.tnursery2'
      '    when :coltype = 3 then fp.tnurserystaff'
      '    when :coltype = 4 then fp.tprimary'
      '    when :coltype = 5 then fp.tprimarystaff'
      '    when :coltype = 6 then fp.thigh'
      '    when :coltype = 7 then fp.thighstaff'
      '    when :coltype = 8 then fp.tstaff'
      'end as et,'
      'case'
      '    when :coltype = 1 then fp.rnursery1'
      '    when :coltype = 2 then fp.rnursery2'
      '    when :coltype = 3 then fp.rnurserystaff'
      '    when :coltype = 4 then fp.rprimary'
      '    when :coltype = 5 then fp.rprimarystaff'
      '    when :coltype = 6 then fp.rhigh'
      '    when :coltype = 7 then fp.rhighstaff'
      '    when :coltype = 8 then fp.rstaff'
      'end as er,'
      'case'
      '    when :coltype = 1 then fp.knursery1'
      '    when :coltype = 2 then fp.knursery2'
      '    when :coltype = 3 then fp.knurserystaff'
      '    when :coltype = 4 then fp.kprimary'
      '    when :coltype = 5 then fp.kprimarystaff'
      '    when :coltype = 6 then fp.khigh'
      '    when :coltype = 7 then fp.khighstaff'
      '    when :coltype = 8 then fp.kstaff'
      'end as ek,'
      'case'
      '    when :coltype = 1 then fp.anursery1'
      '    when :coltype = 2 then fp.anursery2'
      '    when :coltype = 3 then fp.anurserystaff'
      '    when :coltype = 4 then fp.aprimary'
      '    when :coltype = 5 then fp.aprimarystaff'
      '    when :coltype = 6 then fp.ahigh'
      '    when :coltype = 7 then fp.ahighstaff'
      '    when :coltype = 8 then fp.astaff'
      'end as ea,'
      'case'
      '    when :coltype = 1 then fp.snursery1'
      '    when :coltype = 2 then fp.snursery2'
      '    when :coltype = 3 then fp.snurserystaff'
      '    when :coltype = 4 then fp.sprimary'
      '    when :coltype = 5 then fp.sprimarystaff'
      '    when :coltype = 6 then fp.shigh'
      '    when :coltype = 7 then fp.shighstaff'
      '    when :coltype = 8 then fp.sstaff'
      'end as es, cast(:n as float) as nn'
      'from f_portion fp'
      
        'where fp.pdate < :pdate and fp.typeportion= :typeportion  and ((' +
        'fp.isnotuse=0) or (fp.isnotuse is null))'
      'order by fp.pdate desc ) ds'
      'group by 2 ) ds2'
      '')
    GeneratorField.Field = 'SDID'
    Left = 88
    Top = 128
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'n'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'coltype'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'n'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pdate'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'typeportion'
        ParamType = ptUnknown
      end>
    object qAVGSR: TFloatField
      FieldName = 'SR'
      ProviderFlags = []
    end
  end
  object dsReSum: TDataSource
    DataSet = qReSum
    Left = 56
    Top = 192
  end
  object qReSum: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    SQL.Strings = (
      'select FP.*'
      'from F_PORTION FP'
      
        'where fp.idportion >= :idportion and fp.typeportion=:typeportion' +
        '  and ((fp.isnotuse=0) or (fp.isnotuse is null))'
      'order by fp.idportion')
    UpdateObject = quReSum
    GeneratorField.Field = 'SDID'
    Left = 88
    Top = 192
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'idportion'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'typeportion'
        ParamType = ptUnknown
      end>
    object qReSumIDPORTION: TIntegerField
      FieldName = 'IDPORTION'
      Origin = '"F_PORTION"."IDPORTION"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qReSumPDATE: TDateField
      FieldName = 'PDATE'
      Origin = '"F_PORTION"."PDATE"'
    end
    object qReSumTYPEPORTION: TIntegerField
      FieldName = 'TYPEPORTION'
      Origin = '"F_PORTION"."TYPEPORTION"'
    end
    object qReSumTNURSERY1: TIntegerField
      FieldName = 'TNURSERY1'
      Origin = '"F_PORTION"."TNURSERY1"'
    end
    object qReSumRNURSERY1: TIntegerField
      FieldName = 'RNURSERY1'
      Origin = '"F_PORTION"."RNURSERY1"'
    end
    object qReSumKNURSERY1: TIBBCDField
      FieldName = 'KNURSERY1'
      Origin = '"F_PORTION"."KNURSERY1"'
      Precision = 18
      Size = 2
    end
    object qReSumANURSERY1: TIntegerField
      FieldName = 'ANURSERY1'
      Origin = '"F_PORTION"."ANURSERY1"'
    end
    object qReSumTNURSERY2: TIntegerField
      FieldName = 'TNURSERY2'
      Origin = '"F_PORTION"."TNURSERY2"'
    end
    object qReSumRNURSERY2: TIntegerField
      FieldName = 'RNURSERY2'
      Origin = '"F_PORTION"."RNURSERY2"'
    end
    object qReSumKNURSERY2: TIBBCDField
      FieldName = 'KNURSERY2'
      Origin = '"F_PORTION"."KNURSERY2"'
      Precision = 18
      Size = 2
    end
    object qReSumANURSERY2: TIntegerField
      FieldName = 'ANURSERY2'
      Origin = '"F_PORTION"."ANURSERY2"'
    end
    object qReSumTNURSERYSTAFF: TIntegerField
      FieldName = 'TNURSERYSTAFF'
      Origin = '"F_PORTION"."TNURSERYSTAFF"'
    end
    object qReSumRNURSERYSTAFF: TIntegerField
      FieldName = 'RNURSERYSTAFF'
      Origin = '"F_PORTION"."RNURSERYSTAFF"'
    end
    object qReSumKNURSERYSTAFF: TIBBCDField
      FieldName = 'KNURSERYSTAFF'
      Origin = '"F_PORTION"."KNURSERYSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumANURSERYSTAFF: TIntegerField
      FieldName = 'ANURSERYSTAFF'
      Origin = '"F_PORTION"."ANURSERYSTAFF"'
    end
    object qReSumTPRIMARY: TIntegerField
      FieldName = 'TPRIMARY'
      Origin = '"F_PORTION"."TPRIMARY"'
    end
    object qReSumRPRIMARY: TIntegerField
      FieldName = 'RPRIMARY'
      Origin = '"F_PORTION"."RPRIMARY"'
    end
    object qReSumKPRIMARY: TIBBCDField
      FieldName = 'KPRIMARY'
      Origin = '"F_PORTION"."KPRIMARY"'
      Precision = 18
      Size = 2
    end
    object qReSumAPRIMARY: TIntegerField
      FieldName = 'APRIMARY'
      Origin = '"F_PORTION"."APRIMARY"'
    end
    object qReSumTPRIMARYSTAFF: TIntegerField
      FieldName = 'TPRIMARYSTAFF'
      Origin = '"F_PORTION"."TPRIMARYSTAFF"'
    end
    object qReSumRPRIMARYSTAFF: TIntegerField
      FieldName = 'RPRIMARYSTAFF'
      Origin = '"F_PORTION"."RPRIMARYSTAFF"'
    end
    object qReSumKPRIMARYSTAFF: TIBBCDField
      FieldName = 'KPRIMARYSTAFF'
      Origin = '"F_PORTION"."KPRIMARYSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumAPRIMARYSTAFF: TIntegerField
      FieldName = 'APRIMARYSTAFF'
      Origin = '"F_PORTION"."APRIMARYSTAFF"'
    end
    object qReSumTHIGH: TIntegerField
      FieldName = 'THIGH'
      Origin = '"F_PORTION"."THIGH"'
    end
    object qReSumRHIGH: TIntegerField
      FieldName = 'RHIGH'
      Origin = '"F_PORTION"."RHIGH"'
    end
    object qReSumKHIGH: TIBBCDField
      FieldName = 'KHIGH'
      Origin = '"F_PORTION"."KHIGH"'
      Precision = 18
      Size = 2
    end
    object qReSumAHIGH: TIntegerField
      FieldName = 'AHIGH'
      Origin = '"F_PORTION"."AHIGH"'
    end
    object qReSumTHIGHSTAFF: TIntegerField
      FieldName = 'THIGHSTAFF'
      Origin = '"F_PORTION"."THIGHSTAFF"'
    end
    object qReSumRHIGHSTAFF: TIntegerField
      FieldName = 'RHIGHSTAFF'
      Origin = '"F_PORTION"."RHIGHSTAFF"'
    end
    object qReSumKHIGHSTAFF: TIBBCDField
      FieldName = 'KHIGHSTAFF'
      Origin = '"F_PORTION"."KHIGHSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumAHIGHSTAFF: TIntegerField
      FieldName = 'AHIGHSTAFF'
      Origin = '"F_PORTION"."AHIGHSTAFF"'
    end
    object qReSumTSTAFF: TIntegerField
      FieldName = 'TSTAFF'
      Origin = '"F_PORTION"."TSTAFF"'
    end
    object qReSumRSTAFF: TIntegerField
      FieldName = 'RSTAFF'
      Origin = '"F_PORTION"."RSTAFF"'
    end
    object qReSumKSTAFF: TIBBCDField
      FieldName = 'KSTAFF'
      Origin = '"F_PORTION"."KSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumASTAFF: TIntegerField
      FieldName = 'ASTAFF'
      Origin = '"F_PORTION"."ASTAFF"'
    end
    object qReSumDAYWEEK: TIntegerField
      FieldName = 'DAYWEEK'
      Origin = '"F_PORTION"."DAYWEEK"'
    end
    object qReSumISNOTUSE: TIntegerField
      FieldName = 'ISNOTUSE'
      Origin = '"F_PORTION"."ISNOTUSE"'
    end
    object qReSumSNURSERY1: TIBBCDField
      FieldName = 'SNURSERY1'
      Origin = '"F_PORTION"."SNURSERY1"'
      Precision = 18
      Size = 2
    end
    object qReSumSNURSERY2: TIBBCDField
      FieldName = 'SNURSERY2'
      Origin = '"F_PORTION"."SNURSERY2"'
      Precision = 18
      Size = 2
    end
    object qReSumSNURSERYSTAFF: TIBBCDField
      FieldName = 'SNURSERYSTAFF'
      Origin = '"F_PORTION"."SNURSERYSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumSPRIMARY: TIBBCDField
      FieldName = 'SPRIMARY'
      Origin = '"F_PORTION"."SPRIMARY"'
      Precision = 18
      Size = 2
    end
    object qReSumSPRIMARYSTAFF: TIBBCDField
      FieldName = 'SPRIMARYSTAFF'
      Origin = '"F_PORTION"."SPRIMARYSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumSHIGH: TIBBCDField
      FieldName = 'SHIGH'
      Origin = '"F_PORTION"."SHIGH"'
      Precision = 18
      Size = 2
    end
    object qReSumSHIGHSTAFF: TIBBCDField
      FieldName = 'SHIGHSTAFF'
      Origin = '"F_PORTION"."SHIGHSTAFF"'
      Precision = 18
      Size = 2
    end
    object qReSumSSTAFF: TIBBCDField
      FieldName = 'SSTAFF'
      Origin = '"F_PORTION"."SSTAFF"'
      Precision = 18
      Size = 2
    end
  end
  object quReSum: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  IDPORTION,'
      '  PDATE,'
      '  TYPEPORTION,'
      '  TNURSERY1,'
      '  RNURSERY1,'
      '  KNURSERY1,'
      '  ANURSERY1,'
      '  TNURSERY2,'
      '  RNURSERY2,'
      '  KNURSERY2,'
      '  ANURSERY2,'
      '  TNURSERYSTAFF,'
      '  RNURSERYSTAFF,'
      '  KNURSERYSTAFF,'
      '  ANURSERYSTAFF,'
      '  TPRIMARY,'
      '  RPRIMARY,'
      '  KPRIMARY,'
      '  APRIMARY,'
      '  TPRIMARYSTAFF,'
      '  RPRIMARYSTAFF,'
      '  KPRIMARYSTAFF,'
      '  APRIMARYSTAFF,'
      '  THIGH,'
      '  RHIGH,'
      '  KHIGH,'
      '  AHIGH,'
      '  THIGHSTAFF,'
      '  RHIGHSTAFF,'
      '  KHIGHSTAFF,'
      '  AHIGHSTAFF,'
      '  TSTAFF,'
      '  RSTAFF,'
      '  KSTAFF,'
      '  ASTAFF,'
      '  DAYWEEK,'
      '  ISNOTUSE,'
      '  SNURSERY1,'
      '  SNURSERY2,'
      '  SNURSERYSTAFF,'
      '  SPRIMARY,'
      '  SPRIMARYSTAFF,'
      '  SHIGH,'
      '  SHIGHSTAFF,'
      '  SSTAFF'
      'from F_PORTION '
      'where'
      '  IDPORTION = :IDPORTION')
    ModifySQL.Strings = (
      'update F_PORTION'
      'set'
      '  AHIGH = :AHIGH,'
      '  AHIGHSTAFF = :AHIGHSTAFF,'
      '  ANURSERY1 = :ANURSERY1,'
      '  ANURSERY2 = :ANURSERY2,'
      '  ANURSERYSTAFF = :ANURSERYSTAFF,'
      '  APRIMARY = :APRIMARY,'
      '  APRIMARYSTAFF = :APRIMARYSTAFF,'
      '  ASTAFF = :ASTAFF,'
      '  KHIGH = :KHIGH,'
      '  KHIGHSTAFF = :KHIGHSTAFF,'
      '  KNURSERY1 = :KNURSERY1,'
      '  KNURSERY2 = :KNURSERY2,'
      '  KNURSERYSTAFF = :KNURSERYSTAFF,'
      '  KPRIMARY = :KPRIMARY,'
      '  KPRIMARYSTAFF = :KPRIMARYSTAFF,'
      '  KSTAFF = :KSTAFF,'
      '  RHIGH = :RHIGH,'
      '  RHIGHSTAFF = :RHIGHSTAFF,'
      '  RNURSERY1 = :RNURSERY1,'
      '  RNURSERY2 = :RNURSERY2,'
      '  RNURSERYSTAFF = :RNURSERYSTAFF,'
      '  RPRIMARY = :RPRIMARY,'
      '  RPRIMARYSTAFF = :RPRIMARYSTAFF,'
      '  RSTAFF = :RSTAFF,'
      '  SHIGH = :SHIGH,'
      '  SHIGHSTAFF = :SHIGHSTAFF,'
      '  SNURSERY1 = :SNURSERY1,'
      '  SNURSERY2 = :SNURSERY2,'
      '  SNURSERYSTAFF = :SNURSERYSTAFF,'
      '  SPRIMARY = :SPRIMARY,'
      '  SPRIMARYSTAFF = :SPRIMARYSTAFF,'
      '  SSTAFF = :SSTAFF,'
      '  THIGH = :THIGH,'
      '  THIGHSTAFF = :THIGHSTAFF,'
      '  TNURSERY1 = :TNURSERY1,'
      '  TNURSERY2 = :TNURSERY2,'
      '  TNURSERYSTAFF = :TNURSERYSTAFF,'
      '  TPRIMARY = :TPRIMARY,'
      '  TPRIMARYSTAFF = :TPRIMARYSTAFF,'
      '  TSTAFF = :TSTAFF'
      'where'
      '  IDPORTION = :OLD_IDPORTION')
    InsertSQL.Strings = (
      'insert into F_PORTION'
      
        '  (AHIGH, AHIGHSTAFF, ANURSERY1, ANURSERY2, ANURSERYSTAFF, APRIM' +
        'ARY, APRIMARYSTAFF, '
      
        '   ASTAFF, KHIGH, KHIGHSTAFF, KNURSERY1, KNURSERY2, KNURSERYSTAF' +
        'F, KPRIMARY, '
      
        '   KPRIMARYSTAFF, KSTAFF, RHIGH, RHIGHSTAFF, RNURSERY1, RNURSERY' +
        '2, RNURSERYSTAFF, '
      
        '   RPRIMARY, RPRIMARYSTAFF, RSTAFF, SHIGH, SHIGHSTAFF, SNURSERY1' +
        ', SNURSERY2, '
      
        '   SNURSERYSTAFF, SPRIMARY, SPRIMARYSTAFF, SSTAFF, THIGH, THIGHS' +
        'TAFF, TNURSERY1, '
      '   TNURSERY2, TNURSERYSTAFF, TPRIMARY, TPRIMARYSTAFF, TSTAFF)'
      'values'
      
        '  (:AHIGH, :AHIGHSTAFF, :ANURSERY1, :ANURSERY2, :ANURSERYSTAFF, ' +
        ':APRIMARY, '
      
        '   :APRIMARYSTAFF, :ASTAFF, :KHIGH, :KHIGHSTAFF, :KNURSERY1, :KN' +
        'URSERY2, '
      
        '   :KNURSERYSTAFF, :KPRIMARY, :KPRIMARYSTAFF, :KSTAFF, :RHIGH, :' +
        'RHIGHSTAFF, '
      
        '   :RNURSERY1, :RNURSERY2, :RNURSERYSTAFF, :RPRIMARY, :RPRIMARYS' +
        'TAFF, :RSTAFF, '
      
        '   :SHIGH, :SHIGHSTAFF, :SNURSERY1, :SNURSERY2, :SNURSERYSTAFF, ' +
        ':SPRIMARY, '
      
        '   :SPRIMARYSTAFF, :SSTAFF, :THIGH, :THIGHSTAFF, :TNURSERY1, :TN' +
        'URSERY2, '
      '   :TNURSERYSTAFF, :TPRIMARY, :TPRIMARYSTAFF, :TSTAFF)')
    DeleteSQL.Strings = (
      'delete from F_PORTION'
      'where'
      '  IDPORTION = :OLD_IDPORTION')
    Left = 128
    Top = 192
  end
end
